import { createRouter, createWebHistory } from 'vue-router';
import HomePage from "@/views/HomePage.vue"
import LoginPage from "@/views/LoginPage.vue"
import MainPage from "@/views/MainPage.vue"
import Test from "@/views/Test.vue"
import Bookshelf from "@/views/main/Bookshelf.vue"
import Cardnote from "@/views/main/Cardnote.vue"
import Community from "@/views/main/Community.vue"
import Library from "@/views/main/Library.vue"
import Posts from "@/views/main/Posts.vue"

const router = createRouter({
    history: createWebHistory(), // 使用HTML5 History模式
    routes: [{
        path: '/',
        component: HomePage,
    },
    {
        path: '/test',
        name: 'test',
        component: Test,
    },
    {
        path: '/home',
        name: 'home',
        component: HomePage
    },
    {
        path: '/login',
        name: 'login',
        component: LoginPage
    },
    {
        path: '/main', // 默认书架是进入的界面
        component: MainPage,
        children: [
            {
                path: 'bookshelf',
                component: Bookshelf
            },
            {
                path: 'library',
                component: Library
            },
            {
                path: 'cardnote',
                component: Cardnote
            },
            {
                path: 'community',
                component: Community
            },
            {
                path: 'posts',
                component: Posts
            }
        ]
    }
    ]
});

export default router;

